package cn.itcast.mr.order;

import org.apache.hadoop.io.NullWritable;
import org.apache.hadoop.mapreduce.Partitioner;

/**
 * Author itcast
 * Date 2021/10/17 16:16
 * Desc TODO
 */
public class MyPartitioner extends Partitioner<OrderBean, NullWritable> {
    @Override
    public int getPartition(OrderBean orderBean, NullWritable nullWritable, int numPartitions) {
        //得到标签号
        return orderBean.getOid().hashCode() & Integer.MAX_VALUE % numPartitions;
    }
}
